﻿<!--#include file="conn.asp"-->
<!--#include file="inc/CHAR.INC"-->
<%if request("act")="edit" then
ninfo="修改" 
else
ninfo="添加" 
end if
%>
<%set rs=server.createobject("adodb.recordset")
%><%if request("act")="全部删除" then
if request("id")="" then
response.write("<script>alert('错误:没有选定任何内容!');history.go(-1)</script>")
response.end
end if
conn.execute("delete from zz where id in("&request("id")&")")
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
response.end
elseif request("act")="tj" then
conn.execute("update zz set tj = ("&request("tj")&") where id in("&request("id")&")")
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
response.end

end if%>
<%if request("act")="save" then
id=request.form("id")
zzmc=request.form("zzmc")
dqid=request.form("dqid")
zztp=request.form("zztp")
zzjs=request.form("zzjs")
tj=request.form("tj")
zm=left(Hanzi2Pinyin(trim(zzmc)),1)


if id="" then
sql="select * from zz"
rs.open sql,conn,1,3
rs.addnew
else
sql="select * from zz where id="&id
rs.open sql,conn,1,3
end if
rs("zzmc")=zzmc
rs("zm")=zm
rs("dqid")=dqid
rs("zztp")=zztp
rs("zzjs")=htmlencode2(trim(zzjs))
rs("tj")=tj
rs.update
rs.close
set rs=nothing 
response.write("<script>alert('成功："&ninfo&"作者资料成功!现在返回管理');location='zz_manage.asp'</script>")
response.end
end if%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="images/style.css" type="text/css" rel="stylesheet">
    <meta content="MSHTML 6.00.3790.0" name="GENERATOR">
</head>
<body>
    <%
if request("act")="edit" then
id=request("id")
set rs=server.createobject("adodb.recordset")
sql="select * from zz where id="&id
rs.open sql,conn,1,1
zzmc=rs("zzmc")
dqid=rs("dqid")
zztp=rs("zztp")
zzjs=rs("zzjs")
tj=rs("tj")
end if
    %>
    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
        <form name="form1" method="post" action="?act=save">
        <tr bgcolor="3972B4">
            <td colspan="3" bgcolor="e7e7e7">
                <div align="center">
                    <strong><font color="#000000">
                        <%=ninfo%>作者数据</font></strong></div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="17%">
                <div align="right">
                    作者名称</div>
            </td>
            <td width="43%" bgcolor="#FFFFFF">
                <input name="zzmc" type="text" id="zzmc" value="<%=zzmc%>" size="40" /><input name="id"
                    type="hidden" id="id" value="<%=id%>" size="40" />
            </td>
            <td width="40%" rowspan="5" bgcolor="#FFFFFF">
                <div align="center">
                    <%if zztp<>"" then%>
                    <img src="../zpic/<%=zztp%>">
                    <%end if%>
                </div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="17%">
                <div align="right">
                    地区
                </div>
            </td>
            <td width="43%" bgcolor="#FFFFFF">
                <select name="dqid" size="1" id="select" class="dqid">
                    <%  set rs2=server.CreateObject("ADODB.RecordSet")
sql2="select * from diqu"
rs2.Open sql2,conn,1,1
if rs2.EOF then
response.write("<option value=""0"">没有地区</option>")
else
while not rs2.EOF
response.write("<option value="&rs2("id")&"")
if dqid=rs2("id") then
response.write(" selected")
end if
response.write(">"&rs2("diqu")&"</option>")                    
rs2.MoveNext
wend
rs2.close
end if %>
                </select>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="17%" bgcolor="#FFFFFF">
                <div align="right">
                    作者图片</div>
            </td>
            <td bgcolor="#FFFFFF">
                <input name="zztp" type="text" id="zztp" value="<%=zztp%>" size="40" />
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="17%" bgcolor="#FFFFFF">
                <div align="right">
                    介绍</div>
            </td>
            <td bgcolor="#FFFFFF">
                <textarea name="zzjs" cols="40" rows="10" id="zzjs"><%=htmlencode1(zzjs)%></textarea>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td width="17%" bgcolor="#FFFFFF">
                <div align="right">
                    是否推荐</div>
            </td>
            <td bgcolor="#FFFFFF">
                <input name="tj" type="radio" value="0" <%if tj=false then%>checked<%end if%>>
                否
                <input name="tj" type="radio" value="1" <%if tj=true then%>checked<%end if%> />
                是
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td colspan="3">
                <div align="center">
                    <input type="submit" name="Submit" class="Submit" value="确认<%=ninfo%>" />
                </div>
            </td>
        </tr>
        </form>
    </table>
</body>
</html>
<script language="JavaScript" type="text/JavaScript">
    function SwitchNewsType(NewsType) {
        switch (NewsType) {
            case "PicNews":
                document.getElementById('PicNews').style.display = '';
                break;

        }
    }

</script>
